﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using V = Science.Mathematics.VectorCalculus;

namespace VectorCalculus5Ed.Chapter1.Section5
{
    public class Example01
    {
        public Example01()
		{
		}
		private string result;
		public string Result
		{
			get{return result;}
		}
        public void Compute()
        {
            V.Vector x = new V.Vector(4);
            x[0] = 1.0;
            x[1] = 2.0;
            x[2] = 0.0;
            x[3] = -1.0;

            V.Vector y = new V.Vector(4);
            y[0] = -1.0;
            y[1] = 1.0;
            y[2] = 1.0;
            y[3] = 0.0;

            V.Vector s = x + y;

            result += x.Length.ToString()
                + " " + (Math.Sqrt(6.0)).ToString() + "\r\n";
            result += y.Length.ToString()
                + " " + (Math.Sqrt(3.0)).ToString() + "\r\n";
            result += (x * y).ToString() + "\r\n";
            result += s.Length.ToString()
                + " " + (Math.Sqrt(11.0)).ToString() + "\r\n";
        }
    }
}

/* 2.44948974278318 2.44948974278318
1.73205080756888 1.73205080756888
1
3.3166247903554 3.3166247903554  */